package com.ibs.hadoop.spring.mybatis.comm;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;


public interface BaseDAO {
	/**
	 * 插入数据
	 * @param statementName
	 * @param parameterObject
	 * @return
	 * @throws Exception
	 */
	public int insert(String statementName, Object parameterObject) throws DataAccessException;
	
	/**
	 * 更新数据
	 * @param statementName
	 * @param parameterObject
	 * @throws Exception
	 */
	public int update(String statementName, Object parameterObject) throws DataAccessException;
	
	/**
	 * 删除数据
	 * @param statementName
	 * @param parameterObject
	 * @throws Exception
	 */
	public int delete(String statementName, Object parameterObject) throws DataAccessException;
	
	/**
	 * 查询数据(单条)
	 * @param statementName
	 * @param parameterObject
	 * @return
	 * @throws Exception
	 */
	
	
	public <T> T selectOne(String statementName, Object parameterObject) throws DataAccessException;
	
	/**
	 * 查询数据列表
	 * @param statementName
	 * @param parameterObject
	 * @return
	 * @throws Exception
	 */
	public <T> List<T> selectList(String statementName, Object parameterObject)throws DataAccessException;
	
	/**
	 * 查询数据列表(自分页)
	 * @param statementName
	 * @param pageNum
	 * @param pageSize
	 * @param parameterObject
	 * @return
	 * @throws Exception
	 */
	public <T> Pagination<T> selectPagination(String statementName, int pageNum,
			int pageSize, Object parameterObject) throws DataAccessException;

	/**
	 * 查询数据列表(分页 500)
	 * @param statementName
	 * @param pageNum
	 * @param pageSize
	 * @param parameterObject
	 * @return
	 * @throws Exception
	 */
	public <T> Pagination<T> selectList(String statementName, int pageNum, int pageSize, Object parameterObject)throws DataAccessException;
	
	/**
	 * 查询数据列表
	 * @param statementName
	 * @param parameterObject
	 * @return
	 * @throws Exception
	 */
	public <T> Pagination<T> selectRange(String statementName, int start, int limit, Object parameterObject)throws DataAccessException;
		
	/**
	 * 批量插入数据
	 * @param statementName
	 * @param c
	 * @throws DataAccessException
	 */
	public void insertBatch(String statementName, Collection<?> c)throws DataAccessException;
    
    /**
     * 批量更新数据
     * @param statementName
     * @param c
     * @throws DataAccessException
     */
    public void updateBatch(String statementName, Collection<?> c)throws DataAccessException;
	
	
}
